package function;

import java.awt.GraphicsEnvironment;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

public class setting {
	private String nowziti="宋体";
	private int fontsize=18;
	private int plain=0;//是否加粗
	private boolean isshowlinenum=false;
	public boolean isIsshowlinenum() {
		return isshowlinenum;
	}
	public void setIsshowlinenum(boolean isshowlinenum) {
		this.isshowlinenum = isshowlinenum;
	}
	public int getPlain() {
		return plain;
	}
	public void setPlain(int plain) {
		this.plain = plain;
	}
	private String[] zitilist;
	public String getNowziti() {
		return nowziti;
	}
	public void setNowziti(String nowziti) {
		this.nowziti = nowziti;
	}
	public int getFontsize() {
		return fontsize;
	}
	public void setFontsize(int fontsize) {
		this.fontsize = fontsize;
	}
	public String[] getZitilist() {
		return zitilist;
	}
	public setting() {
		try {
			zitilist=GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
			BufferedReader re=new BufferedReader(new FileReader(new File("./data/setting")));
			String a;
			while((a=re.readLine())!=null) {
				if(a.indexOf("nowziti=")>-1)this.nowziti=a.substring(8);
				if(a.indexOf("fontsize=")>-1)this.fontsize=Integer.valueOf(a.substring(9));
				if(a.indexOf("plain=")>-1)this.plain=Integer.valueOf(a.substring(6));
				if(a.indexOf("isshowlinenum=")>-1)this.isshowlinenum=Boolean.valueOf(a.substring(14));
			}
		}catch (Exception e) {
			System.exit(4);
		}
	}
}
